06. Unit Test Coverage
Section 5: Check Unit Test Coverage
Use IntelliJ to check code coverage. Our goal is to cover everything in the Security Service. Other teams will be maintaining our Image Service so we’ll focus strictly on the behavior of the Security Service.
Your goal is to provide full coverage of all methods that implement the application requirements. You don’t need to test trivial methods like getters or setters, but you do need to make sure that all the lines in your other methods are reachable by the unit tests.
Optional Stand Out Task: Integration Tests
Create a FakeSecurityRepository class that works just like the
PretendDatabaseSecurityRepository
class (except without the property files). Create a second test class calledSecurityServiceIntegrationTest.java
and write methods that test our requirements as integration tests.
These tests can call service methods and then use JUnit Assertions to verify that the values you retrieve after performing operations are the expected values.